/*
 * @Author: ZhanXie
 * @Date: 2019-12-28 17:35:06
 * @LastEditors  : ZhanXie
 * @LastEditTime : 2019-12-28 17:37:57
 * @Description: 校验登录中间件
 * @FilePath: /node-demo/blog-express/middleware/loginCheck.js
 */
const { ErrorModal } = require('../model/resModel')

module.exports = (req, res, next) => {
  if (req.session.username) {
    next()
    return
  }
  res.json(
    new ErrorModal('未登录')
  )
}

